#ifndef LINFOLISTWIDGET_H
#define LINFOLISTWIDGET_H

#include <QListWidget>

#define INFO_MAX_ITEM   20480
#define INFO_MAX_RM     5120

class ContextMenu;
class QAction;

class LInfoListWidget : public QListWidget
{
    Q_OBJECT
public:
    explicit LInfoListWidget(QWidget *parent = nullptr);
    ~LInfoListWidget();

    void setAutoScrollToBottom(bool enable);
    void showInfo(const QString &info, const QByteArray &detail = QByteArray());
    QByteArray frame(int row);

private:
    void packInfo();

protected:
    void contextMenuEvent(QContextMenuEvent *e);

signals:

private slots:
    void copyInfo();
    void saveInfo();
    void clearInfo();

private:
    ContextMenu *m_contextMenu;
    QAction *m_copyAct;
    QAction *m_saveAct;
    QAction *m_clearAct;
    bool autoScroll;

    QList<QByteArray> frames;
};

#endif // LINFOLISTWIDGET_H
